/**
 * @param {string} firstWord
 * @param {string} secondWord
 * @param {string} targetWord
 * @return {boolean}
*/
var isSumEqual = function(firstWord, secondWord, targetWord) {
  let firstNum = "", secondNum = "", targetNum = "";
  for(let i = 0; i < firstWord.length; i++) {
    firstNum += (firstWord[i].charCodeAt() - 'a'.charCodeAt()).toString();
  }
  for(let i = 0; i < secondWord.length; i++) {
    secondNum += (secondWord[i].charCodeAt() - 'a'.charCodeAt()).toString();
  }
  for(let i = 0; i < targetWord.length; i++) {
    targetNum += (targetWord[i].charCodeAt() - 'a'.charCodeAt()).toString();
  }
  return parseInt(firstNum) + parseInt(secondNum) == parseInt(targetNum);
};
let firstWord = "acb", secondWord = "cba", targetWord = "cdb";
console.log(isSumEqual(firstWord, secondWord, targetWord));
firstWord = "aaa", secondWord = "a", targetWord = "aab";
console.log(isSumEqual(firstWord, secondWord, targetWord));
firstWord = "aaa", secondWord = "a", targetWord = "aaaa";
console.log(isSumEqual(firstWord, secondWord, targetWord));
